home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus 1995 #5 & #6
/
Amiga Plus CD - 1995 - No. 5 and 6.iso
/
pd
/
serien
/
purity
/
nr.10
/
medplayerlibrary
/
medplay1.0c.p
< prev
next >
Wrap
Text File
|
1995-04-19
|
3KB
|
113 lines
program medplay3;
{
* Medplay.p , 1993 by Diesel, (P)1993 in the Pascal-FD-Serie *
* "Purity". Feel free 2 spread this ! [ This version 1.0c is *
* only 4 use in CLI ] Bernd K., 1993 *
}
{
* This example uses the medplayer.library . Compiled with PCQ- *
* Pascal V1.2 . *
}
{$I "Include:Libraries/medplayer.i" }
{$I "Include:libraries/dos.i" }
{$I "Include:exec/Libraries.i" }
{$I "Include:utils/Parameters.i" }
{$I "Include:intuition/intuition.i" }
Const
NW : NewWindow = ( 10,20,350,11, 0,2, CloseWindow_f,
WindowDrag+WindowDepth+WindowClose+RMBTrap,
NIL, NIL, NIL,NIL, NIL,
0,0,0,0, WBenchScreen_f);
VAR
GP : Integer;
name : String; { für Argument }
buf : Array[0..99] of Char; { vom CLI }
module : MMD0Ptr; { ->Song-Record }
Win : WindowPtr;
WMsgPort : MsgPortPtr;
Msg : IntuiMessagePtr;
{
* Zum sauberen Verlassen des Programms : *
}
Procedure CleanExit( why : String; rt : Integer);
Begin
{
* Window zu *
}
If Win <> NIL then CloseWindow( Win );
{
* Player entfernen *
}
If GP = 0 then FreePlayer;
{
* Song adios *
}
If module <> NIL then UnloadModule( module );
{
* Library zu *
}
If MEDPlayerBase <> NIL then CloseLibrary( MEDPlayerBase );
{
* ggf. Msg ausgeben *
}
If why <> NIL then Begin
write( why );
Delay(50);
End;
Exit( rt ); {
* Bye ! *
}
End;
begin
GP := -1;
name := Adr( buf );
GetParam( 1, name ); {
* CLI-Arg. holen *
}
if buf[0] = chr(0) then
CleanExit("Medplay 1.0c, 1993 by Diesel\nUsage: Medplay med-modulename\n\n",0);
{
* Library aufmachen, logo *
}
MEDPlayerBase := OpenLibrary( medname, 0 );
if MEDPlayerBase = NIL then
CleanExit("Cannot open medplayer.library\n", 10);
GP := GetPlayer(0); {
* Player installieren *
}
If GP <> 0 then
CleanExit("Cannot init player\n",0);
module := LoadModule( name ); {
* Song laden *
}
If module = NIL then
CleanExit("Cannot load module\n",0);
NW.Title := name; {
* Fenster auf *
}
Win := OpenWindow( Adr(NW) );
If Win = NIL then CleanExit("Cannot open window\n",0);
PlayModule(module); {
* Mucke ab ! *
}
WMsgPort:=Win^.UserPort; {
* MsgPort holen *
}
{
* Messages holen *
}
Repeat
Msg := IntuiMessagePtr( WaitPort( WMsgPort ));
Msg := IntuiMessagePtr( GetMsg( WMsgPort ));
Until Msg <> NIL ;
{
* Einzige mögl. Msg = CloseWindow ! *
}
{
* Sicherheitshalber nachfragen, ob noch CW-Msg`s da sind : *
}
REPEAT
ReplyMsg(MessagePtr(Msg)); {
* Msg beantworten *
}
Msg:=IntuiMessagePtr(GetMsg(WMsgPort)); {
* Msg holen, = NIL ? *
}
UNTIL Msg = NIL;
CloseWindow( Win ); {
* Fenster zu *
}
Win := NIL;
DimOffPlayer(10); {
* Song ausblenden *
}
Delay(100); {
* 2 sec. warten *
}
CleanExit( NIL, 0 ); {
* Und tschüß ! *
}
end.